import request from "@/utils/request";

//接口文档地址: https://github.com/bailicangdu/node-elm/blob/master/API.md
/**
 * 获取城市列表
 * @param{string}type [guess：定位城市， hot：热门城市， group：所有城市]
 */
export function cityList(type = "group") {
    return request({
        url: "/v1/cities", method: "get", params: {type: type},
    })
}

/**
 * 获取城市信息
 * @param{number}id
 */
export function cityInfo(id) {
    return request({
        url: "/v1/cities/:id", method: "get", params: {id}
    });
}

/**
 * 登录接口
 * @param {string} account
 * @param {string}password
 * @param {string}captcha_code
 */
export function userLogin(account, password) {
    return request({
        url: "/admin/login",
        method: "post",
        data: {user_name:account, password}
    })
}

/**
 * 注销接口
 * @returns {*}
 */
export function userLogout() {
    return request({url: "/v2/signout", method: "get"})
}